package com.salesmonitoring.controller;

import com.salesmonitoring.dao.LoginDaoImpl;

public class LoginController {
	
	private String username;
	private String password;
	private static LoginController loginController;
	
	public static synchronized LoginController getInstance() {
		if(loginController == null)
			loginController = new LoginController();
		
		return loginController;
	}
	
	public String getUsername() {
		return username;
	}
	
	public void setUsername(String username) {
		this.username = username;
	}
	
	public String getPassword() {
		return password;
	}
	public void setPassword(String password) {
		this.password = password;
	}
	
	public String authenticate() {

		String role = "";
		
		LoginDaoImpl dao = LoginDaoImpl.getInstance();
		role = dao.getUserRole(username, password);
		
		return role;
		
	}
	
	public String getName() {
		
		LoginDaoImpl dao = LoginDaoImpl.getInstance();
		return dao.getUserName(username, password);
		
	}
	
}
